package com.aistar.model.rbm;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Map;

/**
 * @ClassName: RabbitTopic
 * @author: LiuWenXiu
 * @date: 2021/10/21 20:22
 * @Description: TODO...本类用来演示:
 */
//@Component
public class RabbitTopic {
}
//
//    @RabbitListener(queues = "temp1")
//    @RabbitHandler
//    public void getE1(String msg, @Headers Map<String,Object> header, Channel channel){
//        System.out.println("我是队列1的"+msg);
//
//        //手动删除rabbitmq队列中的数据的.
//        long ack = (long) header.get(AmqpHeaders.DELIVERY_TAG);
//        try {
//            channel.basicAck(ack,false);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//
//    @RabbitListener(queues = "temp2")
//    @RabbitHandler
//    public void getE2(String msg, @Headers Map<String,Object> header, Channel channel){
//        System.out.println("我是队列2的"+msg);
//
//        //手动删除rabbitmq队列中的数据的.
//        long ack = (long) header.get(AmqpHeaders.DELIVERY_TAG);
//        try {
//            channel.basicAck(ack,false);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//}
